import axios from 'axios';

const REIMBURSE_BASE_REST_API_URL = "http://localhost:8090/api/v1/reimburses";

class ReimburseService {
    getAllReimburses(params = {}) {
    return axios.get(REIMBURSE_BASE_REST_API_URL, {
        params: params
    }).then(response => response.data); 
}

    createReimburse(reimburse) {
        return axios.post(REIMBURSE_BASE_REST_API_URL, reimburse);
    }

    deleteReimburse(reimburseId) {
        return axios.delete(REIMBURSE_BASE_REST_API_URL + "/" + reimburseId);
    }

    exportReimburses(params = {}) {
        return axios.get(REIMBURSE_BASE_REST_API_URL + "/export", {
            params: params,
            responseType: 'blob' // Important: specify response type as blob
        });
    }
}

export default new ReimburseService();